It is common in a digital photo for the subject of interest to be in focus and for the remaining background, or possibly foreground, to be more or less out of focus. An artist or photo editor will often want to edit the subject of interest in a photo, or the background, separately from the rest of the image. For example the artist may want to obscure, darken or lighten the background. Conversely, the artist may want to enhance the contrast or lighting only in the subject of interest.
It is also often desirable to estimate the distance of objects in a digital photo from the camera. This allows one, for example, to reconstruct a 3D scene from a photograph. This information is typically referred to as “depth” information. The computation of depth information usually requires two photos of the same scene, typically taken at the same time but from slightly different vantage points (i.e. a stereo pair). However, the degree of defocus in a photo can also be correlated with the distance of points in the photo from the camera, especially if one knows the focus setting and aperture setting for the lens that took the picture. Defocus estimates can be useful either alone or in conjunction with a stereo pair to estimate depth information for a photo.
One previously proposed method of estimating the amount of defocus in an image uses the technique of “inverse diffusion.” One problem with this approach is that blur is assumed to arise from a Gaussian blur kernel, which is not an accurate model of the physical process involved. Also, in observed results, the content of the image tends to unduly affect the blur estimate. For example, shadows are often given a different blur estimate than adjacent non-shaded regions, and even smooth backgrounds may not have a single uniform blur estimate.
Another proposed method estimates blur based on the power spectrum of local windows into the image. However, this method is limited to one-dimensional (1D) blur kernels. It also uses a sharp edged window, which makes it impossible to distinguish the sharp edge of the window from sharp edges in the image. In addition, the segmentation generated with this method can only distinguish between part of the image blurred with one blur kernel and those parts of the image that are not blurred with this one kernel. For example, it operates on the assumption that a single, “most likely” blur kernel blurs some part of the image and not others.